<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      let o = {
        name: 'a',
      }
      let age = 18

      let o2 = {
        name: 'a',
        age: age,
      }

      //简便的写法,下面的age属性是：变量名是属性名，变量值是属性值
      let o3 = {
        name: 'a',
        age,
      }

      let gender = true
      let height = 180
      let o4 = {
        gender,
        height,
      }
      console.log(o4.gender)
      console.log(o4.height)

      let o5 = {
        name: 'a',
      }

      //给o5这个对象添加属性，并且此属性自己有一些特性，比如不可写

      Object.defineProperty(o5, 'bj', {
        writable: false,
        value: '164ban',
      })
      console.log(o5.bj)
      o5.bj = '163'
      console.log('改写之后:', o5.bj)
    </script>
  </body>
</html>
